{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Requirement already satisfied: matgraphdb in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (0.0.3)\n",
      "Requirement already satisfied: pytest in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from matgraphdb) (8.3.4)\n",
      "Requirement already satisfied: setuptools in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from matgraphdb) (75.1.0)\n",
      "Requirement already satisfied: setuptools_scm in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from matgraphdb) (8.1.0)\n",
      "Requirement already satisfied: python-dotenv in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from matgraphdb) (1.0.1)\n",
      "Requirement already satisfied: numpy in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from matgraphdb) (1.26.4)\n",
      "Requirement already satisfied: pandas in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from matgraphdb) (2.2.3)\n",
      "Requirement already satisfied: scipy in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from matgraphdb) (1.13.1)\n",
      "Requirement already satisfied: matplotlib in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from matgraphdb) (3.9.4)\n",
      "Requirement already satisfied: seaborn in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from matgraphdb) (0.13.2)\n",
      "Requirement already satisfied: pyyaml in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from matgraphdb) (6.0.2)\n",
      "Requirement already satisfied: jupyterlab in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from matgraphdb) (4.3.3)\n",
      "Requirement already satisfied: nglview in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from matgraphdb) (3.1.4)\n",
      "Requirement already satisfied: ipywidgets in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from matgraphdb) (8.1.5)\n",
      "Requirement already satisfied: pylint in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from matgraphdb) (3.3.2)\n",
      "Requirement already satisfied: autopep8 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from matgraphdb) (2.3.1)\n",
      "Requirement already satisfied: pymatgen in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from matgraphdb) (2024.8.9)\n",
      "Requirement already satisfied: parquetdb in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from matgraphdb) (0.23.4)\n",
      "Requirement already satisfied: variconfig in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from matgraphdb) (0.0.3)\n",
      "Requirement already satisfied: pycodestyle>=2.12.0 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from autopep8->matgraphdb) (2.12.1)\n",
      "Requirement already satisfied: tomli in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from autopep8->matgraphdb) (2.2.1)\n",
      "Requirement already satisfied: comm>=0.1.3 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from ipywidgets->matgraphdb) (0.2.2)\n",
      "Requirement already satisfied: ipython>=6.1.0 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from ipywidgets->matgraphdb) (8.18.1)\n",
      "Requirement already satisfied: traitlets>=4.3.1 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from ipywidgets->matgraphdb) (5.14.3)\n",
      "Requirement already satisfied: widgetsnbextension~=4.0.12 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from ipywidgets->matgraphdb) (4.0.13)\n",
      "Requirement already satisfied: jupyterlab-widgets~=3.0.12 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from ipywidgets->matgraphdb) (3.0.13)\n",
      "Requirement already satisfied: async-lru>=1.0.0 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from jupyterlab->matgraphdb) (2.0.4)\n",
      "Requirement already satisfied: httpx>=0.25.0 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from jupyterlab->matgraphdb) (0.28.1)\n",
      "Requirement already satisfied: importlib-metadata>=4.8.3 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from jupyterlab->matgraphdb) (8.5.0)\n",
      "Requirement already satisfied: ipykernel>=6.5.0 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from jupyterlab->matgraphdb) (6.29.5)\n",
      "Requirement already satisfied: jinja2>=3.0.3 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from jupyterlab->matgraphdb) (3.1.4)\n",
      "Requirement already satisfied: jupyter-core in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from jupyterlab->matgraphdb) (5.7.2)\n",
      "Requirement already satisfied: jupyter-lsp>=2.0.0 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from jupyterlab->matgraphdb) (2.2.5)\n",
      "Requirement already satisfied: jupyter-server<3,>=2.4.0 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from jupyterlab->matgraphdb) (2.14.2)\n",
      "Requirement already satisfied: jupyterlab-server<3,>=2.27.1 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from jupyterlab->matgraphdb) (2.27.3)\n",
      "Requirement already satisfied: notebook-shim>=0.2 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from jupyterlab->matgraphdb) (0.2.4)\n",
      "Requirement already satisfied: packaging in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from jupyterlab->matgraphdb) (24.2)\n",
      "Requirement already satisfied: tornado>=6.2.0 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from jupyterlab->matgraphdb) (6.4.2)\n",
      "Requirement already satisfied: contourpy>=1.0.1 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from matplotlib->matgraphdb) (1.3.0)\n",
      "Requirement already satisfied: cycler>=0.10 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from matplotlib->matgraphdb) (0.12.1)\n",
      "Requirement already satisfied: fonttools>=4.22.0 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from matplotlib->matgraphdb) (4.55.3)\n",
      "Requirement already satisfied: kiwisolver>=1.3.1 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from matplotlib->matgraphdb) (1.4.7)\n",
      "Requirement already satisfied: pillow>=8 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from matplotlib->matgraphdb) (11.0.0)\n",
      "Requirement already satisfied: pyparsing>=2.3.1 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from matplotlib->matgraphdb) (3.2.0)\n",
      "Requirement already satisfied: python-dateutil>=2.7 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from matplotlib->matgraphdb) (2.9.0.post0)\n",
      "Requirement already satisfied: importlib-resources>=3.2.0 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from matplotlib->matgraphdb) (6.4.5)\n",
      "Requirement already satisfied: notebook>=7 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from nglview->matgraphdb) (7.3.1)\n",
      "Requirement already satisfied: pytz>=2020.1 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from pandas->matgraphdb) (2024.2)\n",
      "Requirement already satisfied: tzdata>=2022.7 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from pandas->matgraphdb) (2024.2)\n",
      "Requirement already satisfied: pyarrow in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from parquetdb->matgraphdb) (18.1.0)\n",
      "Requirement already satisfied: beautifulsoup4 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from parquetdb->matgraphdb) (4.12.3)\n",
      "Requirement already satisfied: requests in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from parquetdb->matgraphdb) (2.32.3)\n",
      "Requirement already satisfied: dill in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from parquetdb->matgraphdb) (0.3.9)\n",
      "Requirement already satisfied: pathos in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from parquetdb->matgraphdb) (0.3.3)\n",
      "Requirement already satisfied: dask in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from parquetdb->matgraphdb) (2024.8.0)\n",
      "Requirement already satisfied: distributed in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from parquetdb->matgraphdb) (2024.8.0)\n",
      "Requirement already satisfied: platformdirs>=2.2.0 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from pylint->matgraphdb) (4.3.6)\n",
      "Requirement already satisfied: astroid<=3.4.0-dev0,>=3.3.5 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from pylint->matgraphdb) (3.3.6)\n",
      "Requirement already satisfied: isort!=5.13.0,<6,>=4.2.5 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from pylint->matgraphdb) (5.13.2)\n",
      "Requirement already satisfied: mccabe<0.8,>=0.6 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from pylint->matgraphdb) (0.7.0)\n",
      "Requirement already satisfied: tomlkit>=0.10.1 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from pylint->matgraphdb) (0.13.2)\n",
      "Requirement already satisfied: colorama>=0.4.5 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from pylint->matgraphdb) (0.4.6)\n",
      "Requirement already satisfied: typing-extensions>=3.10.0 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from pylint->matgraphdb) (4.12.2)\n",
      "Requirement already satisfied: joblib>=1 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from pymatgen->matgraphdb) (1.4.2)\n",
      "Requirement already satisfied: monty>=2024.7.29 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from pymatgen->matgraphdb) (2024.10.21)\n",
      "Requirement already satisfied: networkx>=2.2 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from pymatgen->matgraphdb) (3.2.1)\n",
      "Requirement already satisfied: palettable>=3.3.3 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from pymatgen->matgraphdb) (3.3.3)\n",
      "Requirement already satisfied: plotly>=4.5.0 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from pymatgen->matgraphdb) (5.24.1)\n",
      "Requirement already satisfied: pybtex>=0.24.0 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from pymatgen->matgraphdb) (0.24.0)\n",
      "Requirement already satisfied: ruamel.yaml>=0.17.0 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from pymatgen->matgraphdb) (0.18.6)\n",
      "Requirement already satisfied: spglib>=2.5.0 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from pymatgen->matgraphdb) (2.5.0)\n",
      "Requirement already satisfied: sympy>=1.2 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from pymatgen->matgraphdb) (1.13.2)\n",
      "Requirement already satisfied: tabulate>=0.9 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from pymatgen->matgraphdb) (0.9.0)\n",
      "Requirement already satisfied: tqdm>=4.60 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from pymatgen->matgraphdb) (4.67.1)\n",
      "Requirement already satisfied: uncertainties>=3.1.4 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from pymatgen->matgraphdb) (3.2.2)\n",
      "Requirement already satisfied: exceptiongroup>=1.0.0rc8 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from pytest->matgraphdb) (1.2.2)\n",
      "Requirement already satisfied: iniconfig in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from pytest->matgraphdb) (2.0.0)\n",
      "Requirement already satisfied: pluggy<2,>=1.5 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from pytest->matgraphdb) (1.5.0)\n",
      "Requirement already satisfied: toml in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from variconfig->matgraphdb) (0.10.2)\n",
      "Requirement already satisfied: anyio in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from httpx>=0.25.0->jupyterlab->matgraphdb) (4.7.0)\n",
      "Requirement already satisfied: certifi in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from httpx>=0.25.0->jupyterlab->matgraphdb) (2024.8.30)\n",
      "Requirement already satisfied: httpcore==1.* in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from httpx>=0.25.0->jupyterlab->matgraphdb) (1.0.7)\n",
      "Requirement already satisfied: idna in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from httpx>=0.25.0->jupyterlab->matgraphdb) (3.7)\n",
      "Requirement already satisfied: h11<0.15,>=0.13 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from httpcore==1.*->httpx>=0.25.0->jupyterlab->matgraphdb) (0.14.0)\n",
      "Requirement already satisfied: zipp>=3.20 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from importlib-metadata>=4.8.3->jupyterlab->matgraphdb) (3.21.0)\n",
      "Requirement already satisfied: debugpy>=1.6.5 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from ipykernel>=6.5.0->jupyterlab->matgraphdb) (1.8.11)\n",
      "Requirement already satisfied: jupyter-client>=6.1.12 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from ipykernel>=6.5.0->jupyterlab->matgraphdb) (8.6.3)\n",
      "Requirement already satisfied: matplotlib-inline>=0.1 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from ipykernel>=6.5.0->jupyterlab->matgraphdb) (0.1.7)\n",
      "Requirement already satisfied: nest-asyncio in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from ipykernel>=6.5.0->jupyterlab->matgraphdb) (1.6.0)\n",
      "Requirement already satisfied: psutil in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from ipykernel>=6.5.0->jupyterlab->matgraphdb) (6.1.0)\n",
      "Requirement already satisfied: pyzmq>=24 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from ipykernel>=6.5.0->jupyterlab->matgraphdb) (26.2.0)\n",
      "Requirement already satisfied: decorator in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from ipython>=6.1.0->ipywidgets->matgraphdb) (5.1.1)\n",
      "Requirement already satisfied: jedi>=0.16 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from ipython>=6.1.0->ipywidgets->matgraphdb) (0.19.2)\n",
      "Requirement already satisfied: prompt-toolkit<3.1.0,>=3.0.41 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from ipython>=6.1.0->ipywidgets->matgraphdb) (3.0.48)\n",
      "Requirement already satisfied: pygments>=2.4.0 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from ipython>=6.1.0->ipywidgets->matgraphdb) (2.18.0)\n",
      "Requirement already satisfied: stack-data in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from ipython>=6.1.0->ipywidgets->matgraphdb) (0.6.3)\n",
      "Requirement already satisfied: MarkupSafe>=2.0 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from jinja2>=3.0.3->jupyterlab->matgraphdb) (2.1.3)\n",
      "Requirement already satisfied: pywin32>=300 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from jupyter-core->jupyterlab->matgraphdb) (308)\n",
      "Requirement already satisfied: argon2-cffi>=21.1 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (23.1.0)\n",
      "Requirement already satisfied: jupyter-events>=0.9.0 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (0.10.0)\n",
      "Requirement already satisfied: jupyter-server-terminals>=0.4.4 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (0.5.3)\n",
      "Requirement already satisfied: nbconvert>=6.4.4 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (7.16.4)\n",
      "Requirement already satisfied: nbformat>=5.3.0 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (5.10.4)\n",
      "Requirement already satisfied: overrides>=5.0 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (7.7.0)\n",
      "Requirement already satisfied: prometheus-client>=0.9 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (0.21.1)\n",
      "Requirement already satisfied: pywinpty>=2.0.1 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (2.0.14)\n",
      "Requirement already satisfied: send2trash>=1.8.2 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (1.8.3)\n",
      "Requirement already satisfied: terminado>=0.8.3 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (0.18.1)\n",
      "Requirement already satisfied: websocket-client>=1.7 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (1.8.0)\n",
      "Requirement already satisfied: babel>=2.10 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from jupyterlab-server<3,>=2.27.1->jupyterlab->matgraphdb) (2.16.0)\n",
      "Requirement already satisfied: json5>=0.9.0 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from jupyterlab-server<3,>=2.27.1->jupyterlab->matgraphdb) (0.10.0)\n",
      "Requirement already satisfied: jsonschema>=4.18.0 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from jupyterlab-server<3,>=2.27.1->jupyterlab->matgraphdb) (4.23.0)\n",
      "Requirement already satisfied: tenacity>=6.2.0 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from plotly>=4.5.0->pymatgen->matgraphdb) (9.0.0)\n",
      "Requirement already satisfied: latexcodec>=1.0.4 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from pybtex>=0.24.0->pymatgen->matgraphdb) (3.0.0)\n",
      "Requirement already satisfied: six in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from pybtex>=0.24.0->pymatgen->matgraphdb) (1.17.0)\n",
      "Requirement already satisfied: charset-normalizer<4,>=2 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from requests->parquetdb->matgraphdb) (3.3.2)\n",
      "Requirement already satisfied: urllib3<3,>=1.21.1 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from requests->parquetdb->matgraphdb) (1.26.20)\n",
      "Requirement already satisfied: ruamel.yaml.clib>=0.2.7 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from ruamel.yaml>=0.17.0->pymatgen->matgraphdb) (0.2.12)\n",
      "Requirement already satisfied: mpmath<1.4,>=1.1.0 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from sympy>=1.2->pymatgen->matgraphdb) (1.3.0)\n",
      "Requirement already satisfied: soupsieve>1.2 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from beautifulsoup4->parquetdb->matgraphdb) (2.6)\n",
      "Requirement already satisfied: click>=8.1 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from dask->parquetdb->matgraphdb) (8.1.8)\n",
      "Requirement already satisfied: cloudpickle>=1.5.0 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from dask->parquetdb->matgraphdb) (3.1.0)\n",
      "Requirement already satisfied: fsspec>=2021.09.0 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from dask->parquetdb->matgraphdb) (2024.12.0)\n",
      "Requirement already satisfied: partd>=1.4.0 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from dask->parquetdb->matgraphdb) (1.4.2)\n",
      "Requirement already satisfied: toolz>=0.10.0 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from dask->parquetdb->matgraphdb) (1.0.0)\n",
      "Requirement already satisfied: locket>=1.0.0 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from distributed->parquetdb->matgraphdb) (1.0.0)\n",
      "Requirement already satisfied: msgpack>=1.0.0 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from distributed->parquetdb->matgraphdb) (1.1.0)\n",
      "Requirement already satisfied: sortedcontainers>=2.0.5 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from distributed->parquetdb->matgraphdb) (2.4.0)\n",
      "Requirement already satisfied: tblib>=1.6.0 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from distributed->parquetdb->matgraphdb) (3.0.0)\n",
      "Requirement already satisfied: zict>=3.0.0 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from distributed->parquetdb->matgraphdb) (3.0.0)\n",
      "Requirement already satisfied: ppft>=1.7.6.9 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from pathos->parquetdb->matgraphdb) (1.7.6.9)\n",
      "Requirement already satisfied: pox>=0.3.5 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from pathos->parquetdb->matgraphdb) (0.3.5)\n",
      "Requirement already satisfied: multiprocess>=0.70.17 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from pathos->parquetdb->matgraphdb) (0.70.17)\n",
      "Requirement already satisfied: sniffio>=1.1 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from anyio->httpx>=0.25.0->jupyterlab->matgraphdb) (1.3.1)\n",
      "Requirement already satisfied: argon2-cffi-bindings in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from argon2-cffi>=21.1->jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (21.2.0)\n",
      "Requirement already satisfied: parso<0.9.0,>=0.8.4 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from jedi>=0.16->ipython>=6.1.0->ipywidgets->matgraphdb) (0.8.4)\n",
      "Requirement already satisfied: attrs>=22.2.0 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from jsonschema>=4.18.0->jupyterlab-server<3,>=2.27.1->jupyterlab->matgraphdb) (24.2.0)\n",
      "Requirement already satisfied: jsonschema-specifications>=2023.03.6 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from jsonschema>=4.18.0->jupyterlab-server<3,>=2.27.1->jupyterlab->matgraphdb) (2024.10.1)\n",
      "Requirement already satisfied: referencing>=0.28.4 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from jsonschema>=4.18.0->jupyterlab-server<3,>=2.27.1->jupyterlab->matgraphdb) (0.35.1)\n",
      "Requirement already satisfied: rpds-py>=0.7.1 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from jsonschema>=4.18.0->jupyterlab-server<3,>=2.27.1->jupyterlab->matgraphdb) (0.22.3)\n",
      "Requirement already satisfied: python-json-logger>=2.0.4 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (3.2.0)\n",
      "Requirement already satisfied: rfc3339-validator in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (0.1.4)\n",
      "Requirement already satisfied: rfc3986-validator>=0.1.1 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (0.1.1)\n",
      "Requirement already satisfied: bleach!=5.0.0 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (6.2.0)\n",
      "Requirement already satisfied: defusedxml in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (0.7.1)\n",
      "Requirement already satisfied: jupyterlab-pygments in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (0.3.0)\n",
      "Requirement already satisfied: mistune<4,>=2.0.3 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (3.0.2)\n",
      "Requirement already satisfied: nbclient>=0.5.0 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (0.10.1)\n",
      "Requirement already satisfied: pandocfilters>=1.4.1 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (1.5.1)\n",
      "Requirement already satisfied: tinycss2 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (1.4.0)\n",
      "Requirement already satisfied: fastjsonschema>=2.15 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from nbformat>=5.3.0->jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (2.21.1)\n",
      "Requirement already satisfied: wcwidth in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from prompt-toolkit<3.1.0,>=3.0.41->ipython>=6.1.0->ipywidgets->matgraphdb) (0.2.13)\n",
      "Requirement already satisfied: executing>=1.2.0 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from stack-data->ipython>=6.1.0->ipywidgets->matgraphdb) (2.1.0)\n",
      "Requirement already satisfied: asttokens>=2.1.0 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from stack-data->ipython>=6.1.0->ipywidgets->matgraphdb) (3.0.0)\n",
      "Requirement already satisfied: pure-eval in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from stack-data->ipython>=6.1.0->ipywidgets->matgraphdb) (0.2.3)\n",
      "Requirement already satisfied: webencodings in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from bleach!=5.0.0->nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (0.5.1)\n",
      "Requirement already satisfied: fqdn in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (1.5.1)\n",
      "Requirement already satisfied: isoduration in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (20.11.0)\n",
      "Requirement already satisfied: jsonpointer>1.13 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (3.0.0)\n",
      "Requirement already satisfied: uri-template in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (1.3.0)\n",
      "Requirement already satisfied: webcolors>=24.6.0 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (24.11.1)\n",
      "Requirement already satisfied: cffi>=1.0.1 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from argon2-cffi-bindings->argon2-cffi>=21.1->jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (1.17.1)\n",
      "Requirement already satisfied: pycparser in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from cffi>=1.0.1->argon2-cffi-bindings->argon2-cffi>=21.1->jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (2.22)\n",
      "Requirement already satisfied: arrow>=0.15.0 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from isoduration->jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (1.3.0)\n",
      "Requirement already satisfied: types-python-dateutil>=2.8.10 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from arrow>=0.15.0->isoduration->jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->jupyterlab->matgraphdb) (2.9.0.20241206)\n",
      "Requirement already satisfied: ipykernel in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (6.29.5)\n",
      "Requirement already satisfied: comm>=0.1.1 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from ipykernel) (0.2.2)\n",
      "Requirement already satisfied: debugpy>=1.6.5 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from ipykernel) (1.8.11)\n",
      "Requirement already satisfied: ipython>=7.23.1 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from ipykernel) (8.18.1)\n",
      "Requirement already satisfied: jupyter-client>=6.1.12 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from ipykernel) (8.6.3)\n",
      "Requirement already satisfied: jupyter-core!=5.0.*,>=4.12 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from ipykernel) (5.7.2)\n",
      "Requirement already satisfied: matplotlib-inline>=0.1 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from ipykernel) (0.1.7)\n",
      "Requirement already satisfied: nest-asyncio in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from ipykernel) (1.6.0)\n",
      "Requirement already satisfied: packaging in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from ipykernel) (24.2)\n",
      "Requirement already satisfied: psutil in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from ipykernel) (6.1.0)\n",
      "Requirement already satisfied: pyzmq>=24 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from ipykernel) (26.2.0)\n",
      "Requirement already satisfied: tornado>=6.1 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from ipykernel) (6.4.2)\n",
      "Requirement already satisfied: traitlets>=5.4.0 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from ipykernel) (5.14.3)\n",
      "Requirement already satisfied: decorator in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from ipython>=7.23.1->ipykernel) (5.1.1)\n",
      "Requirement already satisfied: jedi>=0.16 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from ipython>=7.23.1->ipykernel) (0.19.2)\n",
      "Requirement already satisfied: prompt-toolkit<3.1.0,>=3.0.41 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from ipython>=7.23.1->ipykernel) (3.0.48)\n",
      "Requirement already satisfied: pygments>=2.4.0 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from ipython>=7.23.1->ipykernel) (2.18.0)\n",
      "Requirement already satisfied: stack-data in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from ipython>=7.23.1->ipykernel) (0.6.3)\n",
      "Requirement already satisfied: typing-extensions in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from ipython>=7.23.1->ipykernel) (4.12.2)\n",
      "Requirement already satisfied: exceptiongroup in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from ipython>=7.23.1->ipykernel) (1.2.2)\n",
      "Requirement already satisfied: colorama in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from ipython>=7.23.1->ipykernel) (0.4.6)\n",
      "Requirement already satisfied: importlib-metadata>=4.8.3 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from jupyter-client>=6.1.12->ipykernel) (8.5.0)\n",
      "Requirement already satisfied: python-dateutil>=2.8.2 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from jupyter-client>=6.1.12->ipykernel) (2.9.0.post0)\n",
      "Requirement already satisfied: platformdirs>=2.5 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from jupyter-core!=5.0.*,>=4.12->ipykernel) (4.3.6)\n",
      "Requirement already satisfied: pywin32>=300 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from jupyter-core!=5.0.*,>=4.12->ipykernel) (308)\n",
      "Requirement already satisfied: zipp>=3.20 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from importlib-metadata>=4.8.3->jupyter-client>=6.1.12->ipykernel) (3.21.0)\n",
      "Requirement already satisfied: parso<0.9.0,>=0.8.4 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from jedi>=0.16->ipython>=7.23.1->ipykernel) (0.8.4)\n",
      "Requirement already satisfied: wcwidth in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from prompt-toolkit<3.1.0,>=3.0.41->ipython>=7.23.1->ipykernel) (0.2.13)\n",
      "Requirement already satisfied: six>=1.5 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from python-dateutil>=2.8.2->jupyter-client>=6.1.12->ipykernel) (1.17.0)\n",
      "Requirement already satisfied: executing>=1.2.0 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from stack-data->ipython>=7.23.1->ipykernel) (2.1.0)\n",
      "Requirement already satisfied: asttokens>=2.1.0 in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from stack-data->ipython>=7.23.1->ipykernel) (3.0.0)\n",
      "Requirement already satisfied: pure-eval in c:\\users\\lllang\\miniconda3\\envs\\matgraphdb_dev\\lib\\site-packages (from stack-data->ipython>=7.23.1->ipykernel) (0.2.3)\n"
     ]
    }
   ],
   "source": [
    "!pip install matgraphdb\n",
    "!pip install ipykernel"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 03 - Graph Generators in MatGraphDB\n",
    "\n",
    "In this notebook, we'll learn how to:\n",
    "\n",
    "1. Create node generator\n",
    "2. Add the node generator to the graph\n",
    "3. Create edge generator\n",
    "4. Add the edge generator to the graph\n",
    "5. Defining dependencies between generators\n",
    "\n",
    "We'll use the `MatGraphDB` class from `matgraphdb` to demonstrate these features. If you haven't already installed `matgraphdb`, run the previous cell.\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 1. Download example data\n",
    "\n",
    "For this tutorial, we will start from example materials data. You can download the data by running the following cell. which downloads the data from the [MatGraphDB GitHub repository](https://github.com/romerogroup/MatGraphDB/tree/main/examples/example_data)."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Data already exists in ./test_data/materials\n"
     ]
    }
   ],
   "source": [
    "import os\n",
    "from matgraphdb.utils.general_utils import download_test_data\n",
    "\n",
    "save_path = \"./test_data/materials\"\n",
    "if os.path.exists(save_path) and len(os.listdir(save_path)) > 0:\n",
    "    print(f\"Data already exists in {save_path}\")\n",
    "    file_path = os.path.join(save_path, \"materials_0.parquet\")\n",
    "else:\n",
    "    file_path = download_test_data(save_path)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Next, we can load the materials data into `MatGraphDB` on initialization. We do this by providing a `MaterialStore` instance to the `materials_store` argument."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "MatGraphDB initialized at: MatGraphDB\n",
      "============================================================\n",
      "GRAPH DATABASE SUMMARY\n",
      "============================================================\n",
      "Name: MatGraphDB\n",
      "Storage path: MatGraphDB\n",
      "└── Repository structure:\n",
      "    ├── nodes/                 (MatGraphDB\\nodes)\n",
      "    ├── edges/                 (MatGraphDB\\edges)\n",
      "    ├── edge_generators/       (MatGraphDB\\edge_generators)\n",
      "    ├── node_generators/       (MatGraphDB\\node_generators)\n",
      "    └── graph/                 (MatGraphDB\\graph)\n",
      "\n",
      "############################################################\n",
      "NODE DETAILS\n",
      "############################################################\n",
      "Total node types: 1\n",
      "------------------------------------------------------------\n",
      "• Node type: materials\n",
      "  - Number of nodes: 1000\n",
      "  - Number of features: 136\n",
      "  - db_path: MatGraphDB\\nodes\\materials\n",
      "------------------------------------------------------------\n",
      "\n",
      "############################################################\n",
      "EDGE DETAILS\n",
      "############################################################\n",
      "Total edge types: 0\n",
      "------------------------------------------------------------\n",
      "\n",
      "############################################################\n",
      "NODE GENERATOR DETAILS\n",
      "############################################################\n",
      "Total node generators: 0\n",
      "------------------------------------------------------------\n",
      "\n",
      "############################################################\n",
      "EDGE GENERATOR DETAILS\n",
      "############################################################\n",
      "Total edge generators: 0\n",
      "------------------------------------------------------------\n",
      "\n"
     ]
    }
   ],
   "source": [
    "import os\n",
    "import shutil\n",
    "\n",
    "from matgraphdb import MatGraphDB, MaterialStore\n",
    "\n",
    "storage_path = \"MatGraphDB\"\n",
    "if os.path.exists(storage_path):\n",
    "    shutil.rmtree(storage_path)\n",
    "\n",
    "materials_dir = os.path.dirname(file_path)\n",
    "material_store = MaterialStore(storage_path=materials_dir)\n",
    "mdb = MatGraphDB(storage_path=storage_path, materials_store=material_store)\n",
    "\n",
    "print(\"MatGraphDB initialized at:\", storage_path)\n",
    "\n",
    "print(mdb.summary())"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Generators\n",
    "\n",
    "A **Generator** is a callable (function) that returns a [PyArrow Table](https://arrow.apache.org/docs/python/api/table.html) of either nodes or edges. By adding a generator to `MatGraphDB`, you can:\n",
    "\n",
    "1. Register the generator, so it can be re-run on demand.\n",
    "2. Optionally specify arguments/kwargs to pass into the generator.\n",
    "3. Automatically store the output in a **NodeStore** or **EdgeStore** with the same name as the generator function (or a custom name, if you prefer).\n",
    "\n",
    "This is especially handy for generating nodes from external data sources or from computational routines.\n",
    "\n",
    "In the following sections we will create custom node and edge generators. These can be create by wrapping existing functions with the `node_generator` or `edge_generator` decorators.\n",
    "\n",
    "These can be imported like:\n",
    "\n",
    "```python\n",
    "from matgraphdb import node_generator, edge_generator\n",
    "```"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Element Node Generator\n",
    "\n",
    "\n",
    "#### 1. Define the Generator\n",
    "\n",
    "In our first example, we will create a node generator that creates element nodes. \n",
    "\n",
    "As mentioned above to create a node generator, we will wrap an existing function with the `node_generator` decorator. The function name will be the name of the node type.\n",
    "\n",
    "```python\n",
    "@node_generator\n",
    "def elements():\n",
    "    ...\n",
    "```\n",
    "\n",
    "For this example, we will import an existing periodic table data from the `matgraphdb` package. This is a dataframe with 118 rows representing 118 elements of the periodic table. We have also added some transformations to the data to make it more useful for our purposes."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "       long_name symbol  abundance_universe  abundance_solar  \\\n",
      "0       Hydrogen      H        7.500000e+01     7.500000e+01   \n",
      "1         Helium     He        2.300000e+01     2.300000e+01   \n",
      "2        Lithium     Li        6.000000e-07     6.000000e-09   \n",
      "3      Beryllium     Be        1.000000e-07     1.000000e-08   \n",
      "4          Boron      B        1.000000e-07     2.000000e-07   \n",
      "..           ...    ...                 ...              ...   \n",
      "113    Flerovium     Fl        0.000000e+00     0.000000e+00   \n",
      "114    Moscovium     Mc        0.000000e+00     0.000000e+00   \n",
      "115  Livermorium     Lv        0.000000e+00     0.000000e+00   \n",
      "116   Tennessine     Ts        0.000000e+00     0.000000e+00   \n",
      "117    Oganesson     Og        0.000000e+00     0.000000e+00   \n",
      "\n",
      "     abundance_meteor  abundance_crust  abundance_ocean  abundance_human  \\\n",
      "0            2.400000     1.500000e-01     1.100000e+01     1.000000e+01   \n",
      "1            0.000000     5.500000e-07     7.200000e-10     0.000000e+00   \n",
      "2            0.000170     1.700000e-03     1.800000e-05     3.000000e-06   \n",
      "3            0.000003     1.900000e-04     6.000000e-11     4.000000e-08   \n",
      "4            0.000160     8.600000e-04     4.400000e-04     7.000000e-05   \n",
      "..                ...              ...              ...              ...   \n",
      "113          0.000000     0.000000e+00     0.000000e+00     0.000000e+00   \n",
      "114          0.000000     0.000000e+00     0.000000e+00     0.000000e+00   \n",
      "115          0.000000     0.000000e+00     0.000000e+00     0.000000e+00   \n",
      "116          0.000000     0.000000e+00     0.000000e+00     0.000000e+00   \n",
      "117          0.000000     0.000000e+00     0.000000e+00     0.000000e+00   \n",
      "\n",
      "    adiabatic_index                                         allotropes  ...  \\\n",
      "0             5-Jul                                         Dihydrogen  ...   \n",
      "1             3-May                                               None  ...   \n",
      "2              None                                               None  ...   \n",
      "3              None                                               None  ...   \n",
      "4              None  Alpha Rhombohedral Boron, Beta Rhombohedral Bo...  ...   \n",
      "..              ...                                                ...  ...   \n",
      "113            None                                               None  ...   \n",
      "114            None                                               None  ...   \n",
      "115            None                                               None  ...   \n",
      "116            None                                               None  ...   \n",
      "117            None                                               None  ...   \n",
      "\n",
      "    is_halogen  is_lanthanoid  is_metal is_metalloid  is_noble_gas  \\\n",
      "0        False          False     False        False         False   \n",
      "1        False          False     False        False          True   \n",
      "2        False          False      True        False         False   \n",
      "3        False          False      True        False         False   \n",
      "4        False          False     False         True         False   \n",
      "..         ...            ...       ...          ...           ...   \n",
      "113      False          False     False        False         False   \n",
      "114      False          False     False        False         False   \n",
      "115      False          False     False        False         False   \n",
      "116      False          False     False        False         False   \n",
      "117      False          False     False        False          True   \n",
      "\n",
      "    is_post_transition_metal is_quadrupolar is_rare_earth_metal  \\\n",
      "0                      False           True               False   \n",
      "1                      False          False               False   \n",
      "2                      False           True               False   \n",
      "3                      False           True               False   \n",
      "4                      False           True               False   \n",
      "..                       ...            ...                 ...   \n",
      "113                    False          False               False   \n",
      "114                    False          False               False   \n",
      "115                    False          False               False   \n",
      "116                    False          False               False   \n",
      "117                    False          False               False   \n",
      "\n",
      "    experimental_oxidation_states                        ionization_energies  \n",
      "0                              []                                   [1312.0]  \n",
      "1                              []                           [2372.3, 5250.5]  \n",
      "2                             [1]                   [520.2, 7298.1, 11815.0]  \n",
      "3                             [2]          [899.5, 1757.1, 14848.7, 21006.6]  \n",
      "4                             [3]  [800.6, 2427.1, 3659.7, 25025.8, 32826.7]  \n",
      "..                            ...                                        ...  \n",
      "113                           [2]    [832.2, 1600.0, 3370.0, 4400.0, 5850.0]  \n",
      "114                           [3]    [538.3, 1760.0, 2650.0, 4680.0, 5720.0]  \n",
      "115                          [-2]    [663.9, 1330.0, 2850.0, 3810.0, 6080.0]  \n",
      "116                          [-1]    [736.9, 1435.4, 2161.9, 4012.9, 5076.4]  \n",
      "117                            []                            [860.1, 1560.0]  \n",
      "\n",
      "[118 rows x 98 columns]\n"
     ]
    }
   ],
   "source": [
    "import pandas as pd\n",
    "from matgraphdb import node_generator\n",
    "from matgraphdb.utils.config import PKG_DIR\n",
    "\n",
    "BASE_ELEMENT_FILE = os.path.join(\n",
    "    PKG_DIR, \"utils\", \"chem_utils\", \"resources\", \"imputed_periodic_table_values.parquet\"\n",
    ")\n",
    "\n",
    "\n",
    "# Define the generator with the @node_generator decorator\n",
    "@node_generator\n",
    "def elements(base_file=BASE_ELEMENT_FILE):\n",
    "    \"\"\"\n",
    "    Creates Element nodes from a local file (CSV or Parquet).\n",
    "    Returns a Pandas DataFrame (or PyArrow Table) with one row per element.\n",
    "    \"\"\"\n",
    "\n",
    "    try:\n",
    "        # Read the file\n",
    "        file_ext = os.path.splitext(base_file)[-1][\n",
    "            1:\n",
    "        ].lower()  # e.g. \"parquet\" or \"csv\"\n",
    "        if file_ext == \"parquet\":\n",
    "            df = pd.read_parquet(base_file)\n",
    "        elif file_ext == \"csv\":\n",
    "            df = pd.read_csv(base_file)\n",
    "        else:\n",
    "            raise ValueError(\"base_file must be a parquet or csv file\")\n",
    "\n",
    "        # Apply some transformations\n",
    "        # Example transformations\n",
    "        df[\"oxidation_states\"] = df[\"oxidation_states\"].apply(\n",
    "            lambda x: x.replace(\"]\", \"\").replace(\"[\", \"\")\n",
    "        )\n",
    "        df[\"oxidation_states\"] = df[\"oxidation_states\"].apply(\n",
    "            lambda x: \",\".join(x.split())\n",
    "        )\n",
    "        df[\"oxidation_states\"] = df[\"oxidation_states\"].apply(\n",
    "            lambda x: eval(\"[\" + x + \"]\")\n",
    "        )\n",
    "        df[\"experimental_oxidation_states\"] = df[\"experimental_oxidation_states\"].apply(\n",
    "            lambda x: eval(x)\n",
    "        )\n",
    "        df[\"ionization_energies\"] = df[\"ionization_energies\"].apply(lambda x: eval(x))\n",
    "\n",
    "    except Exception as e:\n",
    "        print(f\"Error reading element file: {e}\")\n",
    "        return None\n",
    "\n",
    "    return df  # Return the transformed dataframe\n",
    "\n",
    "\n",
    "df = elements()\n",
    "\n",
    "print(df)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 2. Add the Generator to the MatGraphDB\n",
    "\n",
    "Now that we have defined the generator, we can add it to the `MatGraphDB` instance. We do this by calling the `add_node_generator` method. Here we give the function, the arguments, and the kwargs. We also have the option to run the generator immediately or later. Default is True.\n",
    "\n",
    "The node generator will be stored in the `node_generator_store` of the `MatGraphDB` instance.\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "============================================================\n",
      "GENERATOR STORE SUMMARY\n",
      "============================================================\n",
      "• Number of generators: 1\n",
      "Storage path: MatGraphDB\\node_generators\n",
      "\n",
      "\n",
      "############################################################\n",
      "METADATA\n",
      "############################################################\n",
      "• class: GeneratorStore\n",
      "• class_module: matgraphdb.core.generator_store\n",
      "\n",
      "############################################################\n",
      "GENERATOR DETAILS\n",
      "############################################################\n",
      "• Columns:\n",
      "    - generator_func\n",
      "    - generator_kwargs.base_file\n",
      "    - generator_name\n",
      "    - id\n",
      "\n",
      "• Generator names:\n",
      "    - elements\n",
      "\n"
     ]
    }
   ],
   "source": [
    "mdb.add_node_generator(\n",
    "    generator_func=elements,\n",
    "    generator_args={},\n",
    "    generator_kwargs={\"base_file\": BASE_ELEMENT_FILE},\n",
    "    run_immediately=False,  # We have the option to run the generator immediately or later. Default is True.\n",
    ")\n",
    "\n",
    "# Check the node generators in the MatGraphDB\n",
    "\n",
    "print(mdb.node_generator_store)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Running a Node Generator Later\n",
    "\n",
    "Now we can run the node generator with `mdb.run_node_generator(generator_name)`.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>long_name</th>\n",
       "      <th>symbol</th>\n",
       "      <th>abundance_universe</th>\n",
       "      <th>abundance_solar</th>\n",
       "      <th>abundance_meteor</th>\n",
       "      <th>abundance_crust</th>\n",
       "      <th>abundance_ocean</th>\n",
       "      <th>abundance_human</th>\n",
       "      <th>adiabatic_index</th>\n",
       "      <th>allotropes</th>\n",
       "      <th>...</th>\n",
       "      <th>is_halogen</th>\n",
       "      <th>is_lanthanoid</th>\n",
       "      <th>is_metal</th>\n",
       "      <th>is_metalloid</th>\n",
       "      <th>is_noble_gas</th>\n",
       "      <th>is_post_transition_metal</th>\n",
       "      <th>is_quadrupolar</th>\n",
       "      <th>is_rare_earth_metal</th>\n",
       "      <th>experimental_oxidation_states</th>\n",
       "      <th>ionization_energies</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Hydrogen</td>\n",
       "      <td>H</td>\n",
       "      <td>7.500000e+01</td>\n",
       "      <td>7.500000e+01</td>\n",
       "      <td>2.400000</td>\n",
       "      <td>1.500000e-01</td>\n",
       "      <td>1.100000e+01</td>\n",
       "      <td>1.000000e+01</td>\n",
       "      <td>5-Jul</td>\n",
       "      <td>Dihydrogen</td>\n",
       "      <td>...</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>[]</td>\n",
       "      <td>[1312.0]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Helium</td>\n",
       "      <td>He</td>\n",
       "      <td>2.300000e+01</td>\n",
       "      <td>2.300000e+01</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>5.500000e-07</td>\n",
       "      <td>7.200000e-10</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>3-May</td>\n",
       "      <td>None</td>\n",
       "      <td>...</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>[]</td>\n",
       "      <td>[2372.3, 5250.5]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Lithium</td>\n",
       "      <td>Li</td>\n",
       "      <td>6.000000e-07</td>\n",
       "      <td>6.000000e-09</td>\n",
       "      <td>0.000170</td>\n",
       "      <td>1.700000e-03</td>\n",
       "      <td>1.800000e-05</td>\n",
       "      <td>3.000000e-06</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>...</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>[1]</td>\n",
       "      <td>[520.2, 7298.1, 11815.0]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Beryllium</td>\n",
       "      <td>Be</td>\n",
       "      <td>1.000000e-07</td>\n",
       "      <td>1.000000e-08</td>\n",
       "      <td>0.000003</td>\n",
       "      <td>1.900000e-04</td>\n",
       "      <td>6.000000e-11</td>\n",
       "      <td>4.000000e-08</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>...</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>[2]</td>\n",
       "      <td>[899.5, 1757.1, 14848.7, 21006.6]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Boron</td>\n",
       "      <td>B</td>\n",
       "      <td>1.000000e-07</td>\n",
       "      <td>2.000000e-07</td>\n",
       "      <td>0.000160</td>\n",
       "      <td>8.600000e-04</td>\n",
       "      <td>4.400000e-04</td>\n",
       "      <td>7.000000e-05</td>\n",
       "      <td>None</td>\n",
       "      <td>Alpha Rhombohedral Boron, Beta Rhombohedral Bo...</td>\n",
       "      <td>...</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>[3]</td>\n",
       "      <td>[800.6, 2427.1, 3659.7, 25025.8, 32826.7]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>113</th>\n",
       "      <td>Flerovium</td>\n",
       "      <td>Fl</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>...</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>[2]</td>\n",
       "      <td>[832.2, 1600.0, 3370.0, 4400.0, 5850.0]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>114</th>\n",
       "      <td>Moscovium</td>\n",
       "      <td>Mc</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>...</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>[3]</td>\n",
       "      <td>[538.3, 1760.0, 2650.0, 4680.0, 5720.0]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>115</th>\n",
       "      <td>Livermorium</td>\n",
       "      <td>Lv</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>...</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>[-2]</td>\n",
       "      <td>[663.9, 1330.0, 2850.0, 3810.0, 6080.0]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>116</th>\n",
       "      <td>Tennessine</td>\n",
       "      <td>Ts</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>...</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>[-1]</td>\n",
       "      <td>[736.9, 1435.4, 2161.9, 4012.9, 5076.4]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>117</th>\n",
       "      <td>Oganesson</td>\n",
       "      <td>Og</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>...</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>[]</td>\n",
       "      <td>[860.1, 1560.0]</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>118 rows × 98 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "       long_name symbol  abundance_universe  abundance_solar  \\\n",
       "0       Hydrogen      H        7.500000e+01     7.500000e+01   \n",
       "1         Helium     He        2.300000e+01     2.300000e+01   \n",
       "2        Lithium     Li        6.000000e-07     6.000000e-09   \n",
       "3      Beryllium     Be        1.000000e-07     1.000000e-08   \n",
       "4          Boron      B        1.000000e-07     2.000000e-07   \n",
       "..           ...    ...                 ...              ...   \n",
       "113    Flerovium     Fl        0.000000e+00     0.000000e+00   \n",
       "114    Moscovium     Mc        0.000000e+00     0.000000e+00   \n",
       "115  Livermorium     Lv        0.000000e+00     0.000000e+00   \n",
       "116   Tennessine     Ts        0.000000e+00     0.000000e+00   \n",
       "117    Oganesson     Og        0.000000e+00     0.000000e+00   \n",
       "\n",
       "     abundance_meteor  abundance_crust  abundance_ocean  abundance_human  \\\n",
       "0            2.400000     1.500000e-01     1.100000e+01     1.000000e+01   \n",
       "1            0.000000     5.500000e-07     7.200000e-10     0.000000e+00   \n",
       "2            0.000170     1.700000e-03     1.800000e-05     3.000000e-06   \n",
       "3            0.000003     1.900000e-04     6.000000e-11     4.000000e-08   \n",
       "4            0.000160     8.600000e-04     4.400000e-04     7.000000e-05   \n",
       "..                ...              ...              ...              ...   \n",
       "113          0.000000     0.000000e+00     0.000000e+00     0.000000e+00   \n",
       "114          0.000000     0.000000e+00     0.000000e+00     0.000000e+00   \n",
       "115          0.000000     0.000000e+00     0.000000e+00     0.000000e+00   \n",
       "116          0.000000     0.000000e+00     0.000000e+00     0.000000e+00   \n",
       "117          0.000000     0.000000e+00     0.000000e+00     0.000000e+00   \n",
       "\n",
       "    adiabatic_index                                         allotropes  ...  \\\n",
       "0             5-Jul                                         Dihydrogen  ...   \n",
       "1             3-May                                               None  ...   \n",
       "2              None                                               None  ...   \n",
       "3              None                                               None  ...   \n",
       "4              None  Alpha Rhombohedral Boron, Beta Rhombohedral Bo...  ...   \n",
       "..              ...                                                ...  ...   \n",
       "113            None                                               None  ...   \n",
       "114            None                                               None  ...   \n",
       "115            None                                               None  ...   \n",
       "116            None                                               None  ...   \n",
       "117            None                                               None  ...   \n",
       "\n",
       "    is_halogen  is_lanthanoid  is_metal is_metalloid  is_noble_gas  \\\n",
       "0        False          False     False        False         False   \n",
       "1        False          False     False        False          True   \n",
       "2        False          False      True        False         False   \n",
       "3        False          False      True        False         False   \n",
       "4        False          False     False         True         False   \n",
       "..         ...            ...       ...          ...           ...   \n",
       "113      False          False     False        False         False   \n",
       "114      False          False     False        False         False   \n",
       "115      False          False     False        False         False   \n",
       "116      False          False     False        False         False   \n",
       "117      False          False     False        False          True   \n",
       "\n",
       "    is_post_transition_metal is_quadrupolar is_rare_earth_metal  \\\n",
       "0                      False           True               False   \n",
       "1                      False          False               False   \n",
       "2                      False           True               False   \n",
       "3                      False           True               False   \n",
       "4                      False           True               False   \n",
       "..                       ...            ...                 ...   \n",
       "113                    False          False               False   \n",
       "114                    False          False               False   \n",
       "115                    False          False               False   \n",
       "116                    False          False               False   \n",
       "117                    False          False               False   \n",
       "\n",
       "    experimental_oxidation_states                        ionization_energies  \n",
       "0                              []                                   [1312.0]  \n",
       "1                              []                           [2372.3, 5250.5]  \n",
       "2                             [1]                   [520.2, 7298.1, 11815.0]  \n",
       "3                             [2]          [899.5, 1757.1, 14848.7, 21006.6]  \n",
       "4                             [3]  [800.6, 2427.1, 3659.7, 25025.8, 32826.7]  \n",
       "..                            ...                                        ...  \n",
       "113                           [2]    [832.2, 1600.0, 3370.0, 4400.0, 5850.0]  \n",
       "114                           [3]    [538.3, 1760.0, 2650.0, 4680.0, 5720.0]  \n",
       "115                          [-2]    [663.9, 1330.0, 2850.0, 3810.0, 6080.0]  \n",
       "116                          [-1]    [736.9, 1435.4, 2161.9, 4012.9, 5076.4]  \n",
       "117                            []                            [860.1, 1560.0]  \n",
       "\n",
       "[118 rows x 98 columns]"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Here we run the node generator. Notice how we do not need pass the arguments or kwargs, this information is stored in the node generator store.\n",
    "# However, we can override the arguments or kwargs if we want to.\n",
    "mdb.run_node_generator(\"elements\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Lets check the node store for the elements.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "============================================================\n",
      "NODE STORE SUMMARY\n",
      "============================================================\n",
      "Node type: elements\n",
      "• Number of nodes: 118\n",
      "• Number of features: 99\n",
      "Storage path: MatGraphDB\\nodes\\elements\n",
      "\n",
      "\n",
      "############################################################\n",
      "METADATA\n",
      "############################################################\n",
      "• class: NodeStore\n",
      "• class_module: matgraphdb.core.nodes\n",
      "• node_type: elements\n",
      "• name_column: id\n",
      "\n",
      "############################################################\n",
      "NODE DETAILS\n",
      "############################################################\n",
      "• Columns:\n",
      "    - abundance_crust\n",
      "    - abundance_human\n",
      "    - abundance_meteor\n",
      "    - abundance_ocean\n",
      "    - abundance_solar\n",
      "    - abundance_universe\n",
      "    - adiabatic_index\n",
      "    - allotropes\n",
      "    - appearance\n",
      "    - atomic_mass\n",
      "    - atomic_number\n",
      "    - block\n",
      "    - boiling_point\n",
      "    - classifications_cas_number\n",
      "    - classifications_cid_number\n",
      "    - classifications_dot_hazard_class\n",
      "    - classifications_dot_numbers\n",
      "    - classifications_rtecs_number\n",
      "    - coefficient_of_linear_thermal_expansion\n",
      "    - conductivity_electric\n",
      "    - conductivity_thermal\n",
      "    - cpk_hex\n",
      "    - critical_pressure\n",
      "    - critical_temperature\n",
      "    - crystal_structure\n",
      "    - density_stp\n",
      "    - discovered_by\n",
      "    - discovered_location\n",
      "    - discovered_year\n",
      "    - electrical_resistivity\n",
      "    - electrical_type\n",
      "    - electron_affinity\n",
      "    - electron_configuration\n",
      "    - electron_configuration_semantic\n",
      "    - electronegativity_pauling\n",
      "    - energy_levels\n",
      "    - experimental_oxidation_states\n",
      "    - extended_group\n",
      "    - gas_phase\n",
      "    - group\n",
      "    - half_life\n",
      "    - hardness_brinell\n",
      "    - hardness_mohs\n",
      "    - hardness_vickers\n",
      "    - heat_fusion\n",
      "    - heat_molar\n",
      "    - heat_specific\n",
      "    - heat_vaporization\n",
      "    - id\n",
      "    - ionization_energies\n",
      "    - is_actinoid\n",
      "    - is_alkali\n",
      "    - is_alkaline\n",
      "    - is_chalcogen\n",
      "    - is_halogen\n",
      "    - is_lanthanoid\n",
      "    - is_metal\n",
      "    - is_metalloid\n",
      "    - is_noble_gas\n",
      "    - is_post_transition_metal\n",
      "    - is_quadrupolar\n",
      "    - is_rare_earth_metal\n",
      "    - isotopes_known\n",
      "    - isotopes_stable\n",
      "    - isotopic_abundances\n",
      "    - lattice_angles\n",
      "    - lattice_constants\n",
      "    - lifetime\n",
      "    - long_name\n",
      "    - magnetic_susceptibility_mass\n",
      "    - magnetic_susceptibility_molar\n",
      "    - magnetic_susceptibility_volume\n",
      "    - magnetic_type\n",
      "    - melting_point\n",
      "    - modulus_bulk\n",
      "    - modulus_shear\n",
      "    - modulus_young\n",
      "    - molar_volume\n",
      "    - neutron_cross_section\n",
      "    - neutron_mass_absorption\n",
      "    - oxidation_states\n",
      "    - period\n",
      "    - phase\n",
      "    - poisson_ratio\n",
      "    - quantum_numbers\n",
      "    - radius_calculated\n",
      "    - radius_covalent\n",
      "    - radius_empirical\n",
      "    - radius_vanderwaals\n",
      "    - refractive_index\n",
      "    - series\n",
      "    - source\n",
      "    - space_group_name\n",
      "    - space_group_number\n",
      "    - speed_of_sound\n",
      "    - summary\n",
      "    - superconduction_temperature\n",
      "    - symbol\n",
      "    - valence_electrons\n",
      "\n"
     ]
    }
   ],
   "source": [
    "element_node_store = mdb.get_node_store(\"elements\")\n",
    "print(element_node_store)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Material-Element Edge Generator\n",
    "\n",
    "#### 1. Define the Generator\n",
    "\n",
    "An **edge generator** is similar to a node generator but returns a PyArrow Table describing edges. Each generated edge must have at least these fields:\n",
    "\n",
    "- `source_id` (int)\n",
    "- `source_type` (string)\n",
    "- `target_id` (int)\n",
    "- `target_type` (string)\n",
    "\n",
    "Additionally, edge_generators must have the corresponding node_stores in the `MatGraphDB` instance as an argument. This is to ensure that the ids of the nodes are valid and in the correct node store. \n",
    "\n",
    "For edges we use the `edge_generator` decorator.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "from matgraphdb import edge_generator\n",
    "import pyarrow as pa\n",
    "\n",
    "\n",
    "@edge_generator\n",
    "def material_element_has(\n",
    "    material_store, element_store\n",
    "):  # We have the material_store and element_store as an argument\n",
    "    try:\n",
    "        connection_name = \"has\"\n",
    "\n",
    "        # We select only the necessary columns from the node stores\n",
    "        material_table = material_store.read_nodes(\n",
    "            columns=[\"id\", \"core.material_id\", \"core.elements\"]\n",
    "        )\n",
    "        element_table = element_store.read_nodes(columns=[\"id\", \"symbol\"])\n",
    "\n",
    "        # We rename for utility purposes\n",
    "        material_table = material_table.rename_columns(\n",
    "            {\"id\": \"source_id\", \"core.material_id\": \"material_name\"}\n",
    "        )\n",
    "        material_table = material_table.append_column(\n",
    "            \"source_type\", pa.array([\"material\"] * material_table.num_rows)\n",
    "        )\n",
    "\n",
    "        element_table = element_table.rename_columns({\"id\": \"target_id\"})\n",
    "        element_table = element_table.append_column(\n",
    "            \"target_type\", pa.array([\"elements\"] * element_table.num_rows)\n",
    "        )\n",
    "\n",
    "        # We convert the tables to pandas for easier manipulation\n",
    "        material_df = material_table.to_pandas()\n",
    "        element_df = element_table.to_pandas()\n",
    "\n",
    "        # We create a map of the element symbols to the target_id for quick lookup\n",
    "        element_target_id_map = {\n",
    "            row[\"symbol\"]: row[\"target_id\"] for _, row in element_df.iterrows()\n",
    "        }\n",
    "\n",
    "        # We create a dictionary to store the edge data\n",
    "        table_dict = {\n",
    "            \"source_id\": [],\n",
    "            \"source_type\": [],\n",
    "            \"target_id\": [],\n",
    "            \"target_type\": [],\n",
    "            \"edge_type\": [],\n",
    "            \"name\": [],\n",
    "            \"weight\": [],\n",
    "        }\n",
    "\n",
    "        # We iterate over the material nodes\n",
    "        for _, row in material_df.iterrows():\n",
    "            # We get the elements composing the material\n",
    "            elements = row[\"core.elements\"]\n",
    "            source_id = row[\"source_id\"]\n",
    "            material_name = row[\"material_name\"]\n",
    "            if elements is None:\n",
    "                continue\n",
    "\n",
    "            # We iterate over the elements\n",
    "            for element in elements:\n",
    "                # We get the target_id for the element\n",
    "                target_id = element_target_id_map[element]\n",
    "\n",
    "                # We append the edge data to the dictionary. Here we could also define the reverse edge as well.\n",
    "                table_dict[\"source_id\"].append(source_id)\n",
    "                table_dict[\"source_type\"].append(material_store.node_type)\n",
    "                table_dict[\"target_id\"].append(target_id)\n",
    "                table_dict[\"target_type\"].append(element_store.node_type)\n",
    "                table_dict[\"edge_type\"].append(connection_name)\n",
    "\n",
    "                name = f\"{material_name}_{connection_name}_{element}\"\n",
    "                table_dict[\"name\"].append(name)\n",
    "                table_dict[\"weight\"].append(1.0)\n",
    "\n",
    "        # edge_table = ParquetDB.construct_table(table_dict)\n",
    "\n",
    "        # logger.debug(\n",
    "        #     f\"Created material-element-has relationships. Shape: {edge_table.shape}\"\n",
    "        # )\n",
    "        df = pd.DataFrame(table_dict)\n",
    "    except Exception as e:\n",
    "        print(f\"Error creating material-element-has relationships: {e}\")\n",
    "\n",
    "    return df"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 2. Add the Generator to the MatGraphDB\n",
    "\n",
    "Now that we have defined the generator, we can add it to the `MatGraphDB` instance. We do this by calling the `add_edge_generator` method.\n",
    "\n",
    "The edge generator will be stored in the `edge_generator_store` of the `MatGraphDB` instance.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "element_store = mdb.get_node_store(\"elements\")\n",
    "material_store = mdb.get_node_store(\"materials\")\n",
    "\n",
    "mdb.add_edge_generator(\n",
    "    generator_func=material_element_has,\n",
    "    generator_args={\n",
    "        \"material_store\": material_store,\n",
    "        \"element_store\": element_store,\n",
    "    },\n",
    "    generator_kwargs={},\n",
    "    run_immediately=True,\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Lets check the edge generator store."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "============================================================\n",
      "GENERATOR STORE SUMMARY\n",
      "============================================================\n",
      "• Number of generators: 1\n",
      "Storage path: MatGraphDB\\edge_generators\n",
      "\n",
      "\n",
      "############################################################\n",
      "METADATA\n",
      "############################################################\n",
      "• class: GeneratorStore\n",
      "• class_module: matgraphdb.core.generator_store\n",
      "\n",
      "############################################################\n",
      "GENERATOR DETAILS\n",
      "############################################################\n",
      "• Columns:\n",
      "    - generator_args.element_store\n",
      "    - generator_args.material_store\n",
      "    - generator_func\n",
      "    - generator_name\n",
      "    - id\n",
      "\n",
      "• Generator names:\n",
      "    - material_element_has\n",
      "\n"
     ]
    }
   ],
   "source": [
    "print(mdb.edge_generator_store)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Let's check to see if the edge created the edges in the edge store."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "============================================================\n",
      "EDGE STORE SUMMARY\n",
      "============================================================\n",
      "Edge type: material_element_has\n",
      "• Number of edges: 3348\n",
      "• Number of features: 8\n",
      "Storage path: MatGraphDB\\edges\\material_element_has\n",
      "\n",
      "\n",
      "############################################################\n",
      "METADATA\n",
      "############################################################\n",
      "• class: EdgeStore\n",
      "• class_module: matgraphdb.core.edges\n",
      "\n",
      "############################################################\n",
      "EDGE DETAILS\n",
      "############################################################\n",
      "• Columns:\n",
      "    - edge_type\n",
      "    - id\n",
      "    - name\n",
      "    - source_id\n",
      "    - source_type\n",
      "    - target_id\n",
      "    - target_type\n",
      "    - weight\n",
      "\n"
     ]
    }
   ],
   "source": [
    "edge_store = mdb.get_edge_store(\"material_element_has\")\n",
    "print(edge_store)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Updates to node stores.\n",
    "\n",
    "By default, when node and edge generators are added their argument store dependencies are added to the `MatGraphDB` instance. This means that when parent stores are updated, the geneator will run and update their corresponding stores.\n",
    "\n",
    "These stores are stored in the `MatGraphDB/generator_dependency.json` file.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "   id\n",
      "0   0\n",
      "2025-02-11 10:52:11 - matgraphdb.materials.nodes.materials - INFO - Deleting data [0]\n",
      "2025-02-11 10:52:11 - matgraphdb.materials.nodes.materials - INFO - Data deleted successfully.\n",
      "2025-02-11 10:52:11 - matgraphdb.core.graph_db - INFO - Running dependent generators: materials\n",
      "2025-02-11 10:52:11 - matgraphdb.core.graph_db - INFO - Running dependent generator: material_element_has\n",
      "2025-02-11 10:52:12 - matgraphdb.core.graph_db - INFO - Removing existing edge store: material_element_has\n",
      "2025-02-11 10:52:12 - matgraphdb.core.graph_db - INFO - Removing edge store of type material_element_has\n",
      "2025-02-11 10:52:12 - matgraphdb.core.graph_db - INFO - Running dependent generators: material_element_has\n",
      "2025-02-11 10:52:12 - matgraphdb.core.graph_db - INFO - Creating edges of type 'material_element_has'\n",
      "2025-02-11 10:52:12 - matgraphdb.core.graph_db - INFO - Creating new EdgeStore for type: material_element_has\n",
      "2025-02-11 10:52:12 - matgraphdb.core.edges - INFO - Successfully created edges\n",
      "2025-02-11 10:52:12 - matgraphdb.core.graph_db - INFO - Running dependent generators: material_element_has\n",
      "2025-02-11 10:52:12 - matgraphdb.core.graph_db - INFO - Running dependent generators: material_element_has\n",
      "2025-02-11 10:52:12 - matgraphdb.materials.core - INFO - Reading materials.\n",
      "Empty DataFrame\n",
      "Columns: [id]\n",
      "Index: []\n"
     ]
    }
   ],
   "source": [
    "materials_df = mdb.read_materials(columns=[\"id\"], ids=[0]).to_pandas()\n",
    "print(materials_df)\n",
    "\n",
    "mdb.delete_materials(ids=[0])\n",
    "\n",
    "materials_df = mdb.read_materials(columns=[\"id\"], ids=[0]).to_pandas()\n",
    "print(materials_df)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "============================================================\n",
      "EDGE STORE SUMMARY\n",
      "============================================================\n",
      "Edge type: material_element_has\n",
      "• Number of edges: 3345\n",
      "• Number of features: 8\n",
      "Storage path: MatGraphDB\\edges\\material_element_has\n",
      "\n",
      "\n",
      "############################################################\n",
      "METADATA\n",
      "############################################################\n",
      "• class: EdgeStore\n",
      "• class_module: matgraphdb.core.edges\n",
      "\n",
      "############################################################\n",
      "EDGE DETAILS\n",
      "############################################################\n",
      "• Columns:\n",
      "    - edge_type\n",
      "    - id\n",
      "    - name\n",
      "    - source_id\n",
      "    - source_type\n",
      "    - target_id\n",
      "    - target_type\n",
      "    - weight\n",
      "\n"
     ]
    }
   ],
   "source": [
    "edge_store = mdb.get_edge_store(\"material_element_has\")\n",
    "print(edge_store)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "     edge_type    id               name  source_id source_type  target_id  \\\n",
      "0          has     0   mp-1222351_has_F          1   materials          8   \n",
      "1          has     1  mp-1222351_has_Fe          1   materials         25   \n",
      "2          has     2  mp-1222351_has_Li          1   materials          2   \n",
      "3          has     3    mp-651087_has_F          2   materials          8   \n",
      "4          has     4   mp-651087_has_Gd          2   materials         63   \n",
      "...        ...   ...                ...        ...         ...        ...   \n",
      "3340       has  3340  mp-2714707_has_Al        999   materials         12   \n",
      "3341       has  3341  mp-2714707_has_Na        999   materials         10   \n",
      "3342       has  3342   mp-2714707_has_O        999   materials          7   \n",
      "3343       has  3343   mp-2714707_has_S        999   materials         15   \n",
      "3344       has  3344  mp-2714707_has_Zn        999   materials         29   \n",
      "\n",
      "     target_type  weight  \n",
      "0       elements     1.0  \n",
      "1       elements     1.0  \n",
      "2       elements     1.0  \n",
      "3       elements     1.0  \n",
      "4       elements     1.0  \n",
      "...          ...     ...  \n",
      "3340    elements     1.0  \n",
      "3341    elements     1.0  \n",
      "3342    elements     1.0  \n",
      "3343    elements     1.0  \n",
      "3344    elements     1.0  \n",
      "\n",
      "[3345 rows x 8 columns]\n"
     ]
    }
   ],
   "source": [
    "df = edge_store.read_edges().to_pandas()\n",
    "print(df)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "============================================================\n",
      "GRAPH DATABASE SUMMARY\n",
      "============================================================\n",
      "Name: MatGraphDB\n",
      "Storage path: MatGraphDB\n",
      "└── Repository structure:\n",
      "    ├── nodes/                 (MatGraphDB\\nodes)\n",
      "    ├── edges/                 (MatGraphDB\\edges)\n",
      "    ├── edge_generators/       (MatGraphDB\\edge_generators)\n",
      "    ├── node_generators/       (MatGraphDB\\node_generators)\n",
      "    └── graph/                 (MatGraphDB\\graph)\n",
      "\n",
      "############################################################\n",
      "NODE DETAILS\n",
      "############################################################\n",
      "Total node types: 2\n",
      "------------------------------------------------------------\n",
      "• Node type: materials\n",
      "  - Number of nodes: 999\n",
      "  - Number of features: 136\n",
      "  - Columns:\n",
      "       - bonding.cutoff_method.bond_connections\n",
      "       - bonding.electric_consistent.bond_connections\n",
      "       - bonding.electric_consistent.bond_orders\n",
      "       - bonding.geometric_consistent.bond_connections\n",
      "       - bonding.geometric_consistent.bond_orders\n",
      "       - bonding.geometric_electric_consistent.bond_connections\n",
      "       - bonding.geometric_electric_consistent.bond_orders\n",
      "       - chargemol.bond_connections\n",
      "       - chargemol.bond_orders\n",
      "       - chargemol.cubed_moments\n",
      "       - chargemol.fourth_moments\n",
      "       - chargemol.squared_moments\n",
      "       - chemenv.coordination_environments_multi_weight\n",
      "       - chemenv.coordination_multi_connections\n",
      "       - chemenv.coordination_multi_numbers\n",
      "       - core.atomic_numbers\n",
      "       - core.cartesian_coords\n",
      "       - core.density\n",
      "       - core.density_atomic\n",
      "       - core.elements\n",
      "       - core.energy_per_atom\n",
      "       - core.formula\n",
      "       - core.formula_pretty\n",
      "       - core.frac_coords\n",
      "       - core.is_gap_direct\n",
      "       - core.is_magnetic\n",
      "       - core.is_metal\n",
      "       - core.is_stable\n",
      "       - core.lattice\n",
      "       - core.material_id\n",
      "       - core.nelements\n",
      "       - core.nsites\n",
      "       - core.species\n",
      "       - core.volume\n",
      "       - dielectric.e_electronic\n",
      "       - dielectric.e_ij_max\n",
      "       - dielectric.e_ionic\n",
      "       - dielectric.e_total\n",
      "       - dielectric.n\n",
      "       - elasticity.compliance_tensor_ieee_format\n",
      "       - elasticity.compliance_tensor_raw\n",
      "       - elasticity.debye_temperature\n",
      "       - elasticity.elastic_tensor_ieee_format\n",
      "       - elasticity.elastic_tensor_raw\n",
      "       - elasticity.g_reuss\n",
      "       - elasticity.g_voigt\n",
      "       - elasticity.g_vrh\n",
      "       - elasticity.homogeneous_poisson\n",
      "       - elasticity.k_reuss\n",
      "       - elasticity.k_voigt\n",
      "       - elasticity.k_vrh\n",
      "       - elasticity.order\n",
      "       - elasticity.sound_velocity_acoustic\n",
      "       - elasticity.sound_velocity_longitudinal\n",
      "       - elasticity.sound_velocity_optical\n",
      "       - elasticity.sound_velocity_total\n",
      "       - elasticity.sound_velocity_transverse\n",
      "       - elasticity.state\n",
      "       - elasticity.thermal_conductivity_cahill\n",
      "       - elasticity.thermal_conductivity_clarke\n",
      "       - elasticity.universal_anisotropy\n",
      "       - elasticity.warnings\n",
      "       - elasticity.young_modulus\n",
      "       - electronic_structure.band_gap\n",
      "       - electronic_structure.cbm\n",
      "       - electronic_structure.dos_energy_up\n",
      "       - electronic_structure.efermi\n",
      "       - electronic_structure.vbm\n",
      "       - feature_vectors.element_fraction\n",
      "       - feature_vectors.element_property\n",
      "       - feature_vectors.sine_coulomb_matrix\n",
      "       - feature_vectors.xrd_pattern\n",
      "       - grain_boundaries.grain_boundaries\n",
      "       - has_props.absorption\n",
      "       - has_props.bandstructure\n",
      "       - has_props.charge_density\n",
      "       - has_props.chemenv\n",
      "       - has_props.dielectric\n",
      "       - has_props.dos\n",
      "       - has_props.elasticity\n",
      "       - has_props.electronic_structure\n",
      "       - has_props.eos\n",
      "       - has_props.grain_boundaries\n",
      "       - has_props.insertion_electrodes\n",
      "       - has_props.magnetism\n",
      "       - has_props.materials\n",
      "       - has_props.oxi_states\n",
      "       - has_props.phonon\n",
      "       - has_props.piezoelectric\n",
      "       - has_props.provenance\n",
      "       - has_props.substrates\n",
      "       - has_props.surface_properties\n",
      "       - has_props.thermo\n",
      "       - has_props.xas\n",
      "       - id\n",
      "       - magnetism.num_magnetic_sites\n",
      "       - magnetism.num_unique_magnetic_sites\n",
      "       - magnetism.ordering\n",
      "       - magnetism.total_magnetization\n",
      "       - magnetism.total_magnetization_normalized_vol\n",
      "       - magnetism.types_of_magnetic_species\n",
      "       - metadata.last_updated\n",
      "       - metadata.theoretical\n",
      "       - oxidation_states.method\n",
      "       - oxidation_states.possible_species\n",
      "       - oxidation_states.possible_valences\n",
      "       - structure.@class\n",
      "       - structure.@module\n",
      "       - structure.charge\n",
      "       - structure.lattice.a\n",
      "       - structure.lattice.alpha\n",
      "       - structure.lattice.b\n",
      "       - structure.lattice.beta\n",
      "       - structure.lattice.c\n",
      "       - structure.lattice.gamma\n",
      "       - structure.lattice.matrix\n",
      "       - structure.lattice.pbc\n",
      "       - structure.lattice.volume\n",
      "       - structure.sites\n",
      "       - surface_properties.shape_factor\n",
      "       - surface_properties.surface_anisotropy\n",
      "       - surface_properties.weighted_surface_energy\n",
      "       - surface_properties.weighted_surface_energy_EV_PER_ANG2\n",
      "       - surface_properties.weighted_work_function\n",
      "       - symmetry.crystal_system\n",
      "       - symmetry.number\n",
      "       - symmetry.point_group\n",
      "       - symmetry.symbol\n",
      "       - symmetry.symprec\n",
      "       - symmetry.version\n",
      "       - symmetry.wyckoffs\n",
      "       - thermo.decomposes_to\n",
      "       - thermo.energy_above_hull\n",
      "       - thermo.equilibrium_reaction_energy_per_atom\n",
      "       - thermo.formation_energy_per_atom\n",
      "       - thermo.uncorrected_energy_per_atom\n",
      "  - db_path: MatGraphDB\\nodes\\materials\n",
      "------------------------------------------------------------\n",
      "• Node type: elements\n",
      "  - Number of nodes: 118\n",
      "  - Number of features: 99\n",
      "  - Columns:\n",
      "       - abundance_crust\n",
      "       - abundance_human\n",
      "       - abundance_meteor\n",
      "       - abundance_ocean\n",
      "       - abundance_solar\n",
      "       - abundance_universe\n",
      "       - adiabatic_index\n",
      "       - allotropes\n",
      "       - appearance\n",
      "       - atomic_mass\n",
      "       - atomic_number\n",
      "       - block\n",
      "       - boiling_point\n",
      "       - classifications_cas_number\n",
      "       - classifications_cid_number\n",
      "       - classifications_dot_hazard_class\n",
      "       - classifications_dot_numbers\n",
      "       - classifications_rtecs_number\n",
      "       - coefficient_of_linear_thermal_expansion\n",
      "       - conductivity_electric\n",
      "       - conductivity_thermal\n",
      "       - cpk_hex\n",
      "       - critical_pressure\n",
      "       - critical_temperature\n",
      "       - crystal_structure\n",
      "       - density_stp\n",
      "       - discovered_by\n",
      "       - discovered_location\n",
      "       - discovered_year\n",
      "       - electrical_resistivity\n",
      "       - electrical_type\n",
      "       - electron_affinity\n",
      "       - electron_configuration\n",
      "       - electron_configuration_semantic\n",
      "       - electronegativity_pauling\n",
      "       - energy_levels\n",
      "       - experimental_oxidation_states\n",
      "       - extended_group\n",
      "       - gas_phase\n",
      "       - group\n",
      "       - half_life\n",
      "       - hardness_brinell\n",
      "       - hardness_mohs\n",
      "       - hardness_vickers\n",
      "       - heat_fusion\n",
      "       - heat_molar\n",
      "       - heat_specific\n",
      "       - heat_vaporization\n",
      "       - id\n",
      "       - ionization_energies\n",
      "       - is_actinoid\n",
      "       - is_alkali\n",
      "       - is_alkaline\n",
      "       - is_chalcogen\n",
      "       - is_halogen\n",
      "       - is_lanthanoid\n",
      "       - is_metal\n",
      "       - is_metalloid\n",
      "       - is_noble_gas\n",
      "       - is_post_transition_metal\n",
      "       - is_quadrupolar\n",
      "       - is_rare_earth_metal\n",
      "       - isotopes_known\n",
      "       - isotopes_stable\n",
      "       - isotopic_abundances\n",
      "       - lattice_angles\n",
      "       - lattice_constants\n",
      "       - lifetime\n",
      "       - long_name\n",
      "       - magnetic_susceptibility_mass\n",
      "       - magnetic_susceptibility_molar\n",
      "       - magnetic_susceptibility_volume\n",
      "       - magnetic_type\n",
      "       - melting_point\n",
      "       - modulus_bulk\n",
      "       - modulus_shear\n",
      "       - modulus_young\n",
      "       - molar_volume\n",
      "       - neutron_cross_section\n",
      "       - neutron_mass_absorption\n",
      "       - oxidation_states\n",
      "       - period\n",
      "       - phase\n",
      "       - poisson_ratio\n",
      "       - quantum_numbers\n",
      "       - radius_calculated\n",
      "       - radius_covalent\n",
      "       - radius_empirical\n",
      "       - radius_vanderwaals\n",
      "       - refractive_index\n",
      "       - series\n",
      "       - source\n",
      "       - space_group_name\n",
      "       - space_group_number\n",
      "       - speed_of_sound\n",
      "       - summary\n",
      "       - superconduction_temperature\n",
      "       - symbol\n",
      "       - valence_electrons\n",
      "  - db_path: MatGraphDB\\nodes\\elements\n",
      "------------------------------------------------------------\n",
      "\n",
      "############################################################\n",
      "EDGE DETAILS\n",
      "############################################################\n",
      "Total edge types: 1\n",
      "------------------------------------------------------------\n",
      "• Edge type: material_element_has\n",
      "  - Number of edges: 3345\n",
      "  - Number of features: 8\n",
      "  - Columns:\n",
      "       - edge_type\n",
      "       - id\n",
      "       - name\n",
      "       - source_id\n",
      "       - source_type\n",
      "       - target_id\n",
      "       - target_type\n",
      "       - weight\n",
      "  - db_path: MatGraphDB\\edges\\material_element_has\n",
      "------------------------------------------------------------\n",
      "\n",
      "############################################################\n",
      "NODE GENERATOR DETAILS\n",
      "############################################################\n",
      "Total node generators: 1\n",
      "------------------------------------------------------------\n",
      "• Generator: elements\n",
      "Generator Args:\n",
      "  - generator_func: [<function wrapper at 0x00000273649D3790>]\n",
      "  - generator_kwargs.base_file: ['C:\\\\Users\\\\lllang\\\\Desktop\\\\Current_Projects\\\\MatGraphDB\\\\matgraphdb\\\\utils\\\\chem_utils\\\\resources\\\\imputed_periodic_table_values.parquet']\n",
      "  - generator_name: ['elements']\n",
      "  - id: [0]\n",
      "Generator Kwargs:\n",
      "  - base_file: ['C:\\\\Users\\\\lllang\\\\Desktop\\\\Current_Projects\\\\MatGraphDB\\\\matgraphdb\\\\utils\\\\chem_utils\\\\resources\\\\imputed_periodic_table_values.parquet']\n",
      "------------------------------------------------------------\n",
      "\n",
      "############################################################\n",
      "EDGE GENERATOR DETAILS\n",
      "############################################################\n",
      "Total edge generators: 1\n",
      "------------------------------------------------------------\n",
      "• Generator: material_element_has\n",
      "Generator Args:\n",
      "  - element_store: MatGraphDB\\nodes\\elements\n",
      "  - material_store: MatGraphDB\\nodes\\materials\n",
      "Generator Kwargs:\n",
      "------------------------------------------------------------\n",
      "\n"
     ]
    }
   ],
   "source": [
    "print(mdb)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 6. Summary\n",
    "\n",
    "In this notebook, we showed how to define custom node and edge generators and showed how to run them."
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "matgraphdb_dev",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.21"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}